package com.project.service;

import com.project.entity.User;

import java.util.List;

/**
 * Created by TAO on 2015/10/1.
 */
public interface UserService {


    /**
     * 创建用户
     *
     * @param user
     */
    int createUser(User user) throws Exception;

    /**
     * 修改用户
     *
     * @param user
     * @return
     */
    int updateUser(User user) throws Exception;


    /**
     * 查找用户
     *
     * @param userId
     * @return
     */
    User findOneAllByUserID(Integer userId) throws Exception;

    /**
     * 查找用户(默认过滤用户名密码)
     *
     * @param userId
     * @return
     */
    User findOneByUserID(Integer userId) throws Exception;

    //查找全部用户
    List<User> findAll(User user);


    /**
     * 根据用户名查找用户
     *
     * @param username
     * @return
     */
    User findByUserName(String username) throws Exception;

    /**
     * author:WheelChen
     * date:2017/5/7
     * function:修改密码时验证旧密码是否正确
     *
     * @param sessionUser
     * @param password
     * @return
     */
    Boolean validatePassword(User sessionUser, String password);

    /**
     * author: WheelChen
     * date: 2017/7/21
     * function: 批量创建用户
     *
     * @param users
     * @return
     */
    int addUserBatch(List<User> users) throws Exception;

    /**
     * author: WheelChen
     * date: 2017/8/8
     * function: 根据userId查找未加密信息
     *
     * @param userId 用户id
     * @return
     */
    User findByUserIdUnDecry(Integer userId);

    /**
     * author: WheelChen
     * date: 2017/8/9
     * function: 查询用户信息且不解密
     *
     * @param userId 用户id
     * @return
     */
    User findByUserIdUnDecryAndFileterSensitive(Integer userId);
    /**
     * author: WheelChen
     * date: 2017/8/8
     * function: 检查手机号码是否存在
     *
     * @param mobilephone 手机号码
     * @return true - 存在 false - 不存在
     */
    Boolean checkMobilePhoneIsExist(String mobilephone);

    /**
     * author: WheelChen
     * date: 2017/8/8
     * function: 检查用户名是否存在
     * 
     * @param username 用户名
     * @return true - 存在 false - 不存在
     */
    Boolean checkUsernameIsExist(String username);

    /**
     * author: WheelChen
     * date: 2017/8/9
     * function: 根据id删除用户
     *
     * @param id
     * @return
     */
    int removeOneById(Integer id);

    /**
     * author: WheelChen
     * date: 2017/9/19
     * function: 根据ids批量删除
     *
     * @param idList
     * @return
     */
    int removeBatchByIdList(List idList);


}